package web.filter;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.annotation.WebServlet;
import java.io.IOException;

@WebFilter("/*")
public class Filter001_CharacterFilter implements Filter {
    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        request.setCharacterEncoding("utf-8");

        //响应乱码:过滤器不处理响应乱码，因为业务响应的数据类型是不确定的。响应乱码在对应的Servlet中单独解决
//        response.setContentType("text/html;charset=utf-8");

        //放行
        chain.doFilter(request,response);
    }
}
